/*
 * @(#)NewsCommentDao.java 2011-12-29
 *
 * Copyright 2011 北龙中网（北京）科技有限责任公司. All rights reserved.
 */
package cn.shangjia.shop.dao;

import java.util.List;

import org.springframework.stereotype.Repository;
import org.springframework.util.Assert;

import cn.shangjia.common.domain.NewsComment;

/**
 *
 * @author <a href="mailto:jinzhongze@knet.cn">jinzhongze</a>
 * @version 1.0, 2011-12-29 13:31:55
 * @since 1.0
 */
@Repository
public class NewsCommentDao extends AbstractCacheDao<NewsComment> {
	
	@Override
	protected String getPK() {
		return "newsId";
	}
	
	/**
	 *  批量插入 
	 * 
	 * @param comments
	 * @return
	 * @author <a href="mailto:jinzhongze@knet.cn">jinzhongze</a>
	 */
	public int batchInsert(List<NewsComment> comments) {
		Assert.notNull(comments);
		if (comments.isEmpty())
			return 0;
		if (comments.size() > 2000)
			throw new IllegalArgumentException("list size 2000");
		return getSqlSession().insert(getClassName() + ".batchInsert", comments);
	}
	
}
